<template>
  <div>
    <HomeBook
      :row="category.length / 2"
      :col="2"
      :data="category"
      @onBookClick="onCategoryClick"
      :show-title="false"
      :show-btn="false"
      mode="category"
    >
    </HomeBook>
  </div>
</template>

<script>
import HomeBook from '../../components/home/HomeBook'
import {categoryList} from '../../api'

export default {
  name: 'categoryList',
  components: {HomeBook},
  data () {
    return {
      category: []
    }
  },
  methods: {
    onCategoryClick (category) {
      console.log(category)
      this.$router.push({
        path: '/pages/list/main',
        query: {
          key: 'categoryId',
          text: category.category,
          title: category.categoryText
        }
      })
    }
  },
  mounted () {
    categoryList().then(res => {
      this.category = res.data.data
    })
  }
}
</script>

<style lang="stylus" scoped>

</style>
